import Mock from 'mockjs'

/**
 * 分页获取列表
 * 数据：该用户的人头  订单  邀请奖励  签单奖励
 */
export const getSaleAchievementPage = async (
  params: pagination & SaleAchievement
): Promise<ListSaleAchievementRes> => {
  const res = await Mock.mock({
    'list|10': [
      {
        'id|+1': 1,
        clientUserId: '@integer(13000000000, 18999999999)',
        nickName: '@cname',
        avatar: '@image(200x200)',
        name: '@cname',
        phone: '@integer(13000000000, 18999999999)',
        totalInvite: '@integer(0, 100)',
        totalOrder: '@integer(0, 100)',
        totalSignReward: '@integer(0, 100)',
        totalInviteReward: '@integer(0, 100)',
        createTime: 1691143890537
      }
    ],
    pageNo: 1,
    pageSize: 10,
    total: 30
  })
  return res
}

/**
 * 获取用户详情
 */
export const getRelation = async (userId: number): Promise<SaleAchievement> => {
  const res = await Mock.mock({
    data: {
      'id|+1': 1,
      clientUserId: '@integer(13000000000, 18999999999)',
      nickName: '@cname',
      avatar: '@image(200x200)',
      name: '@cname',
      phone: '@integer(13000000000, 18999999999)',
      totalInvite: '@integer(0, 100)',
      totalOrder: '@integer(0, 100)',
      totalSignReward: '@integer(0, 100)',
      totalInviteReward: '@integer(0, 100)',
      createTime: 1691143890537
    }
  })
  return res
}

/**
 * 更新用户信息
 */
export const updateRelation = async (params: SaleAchievement): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}

/**
 * 删除用户信息
 */
export const deleteRelation = async (userId: number): Promise<ResStatus> => {
  const res = await Mock.mock({
    isSuccess: true
  })
  return res
}
